package com.hanfb.mall.inventory.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import redis.clients.jedis.HostAndPort;
import redis.clients.jedis.JedisCluster;

import java.util.HashSet;
import java.util.Set;

/**
 * @作者： Hanfb
 * @描述：
 * @时间： 2020年09月24日
 */
@Configuration
public class JedisConfig {

    @Bean
    public JedisCluster JedisClusterFactory(){
        Set<HostAndPort> jedisClusterNodes=new HashSet<>();
        jedisClusterNodes.add(new HostAndPort("192.168.32.131",7001));
        jedisClusterNodes.add(new HostAndPort("192.168.32.131",7002));
        jedisClusterNodes.add(new HostAndPort("192.168.32.132",7003));
        JedisCluster jedisCluster=new JedisCluster(jedisClusterNodes);
        return jedisCluster;
    }
}
